Page({

        data: {},
        onLoad: function (options) {
                wx.setNavigationBarTitle({
                        title: '忘记密码'
                        })
        },
        next_one(e){
                var user_name = e.detail.value.user_name 
                var user_id = e.detail.value.user_id 
                wx.request({
                  url: 'http://localhost:3000/find_user',
                  method:"POST",
                  data:{
                        user_id : user_id,
                        user_name : user_name
                  },
                  success(res){
                          console.log(res.data.num)
                          var auth_code = res.data.num
                          var aaaa = {auth_code , user_id}
                        if(res.data.text == "找到了"){
                                wx.showModal({  
                                        title: '验证码',  
                                        content: auth_code,  
                                        success: function(res) {
                                        if (res.confirm) {  
                                        console.log('用户点击确定')  
                                        wx.navigateTo({
                                        url: './next_one/next_one?data='+ encodeURIComponent(JSON.stringify(aaaa)),
                                        })
                                        } else if (res.cancel) {  
                                        wx.navigateTo({
                                        url: './next_one/next_one?data='+ encodeURIComponent(JSON.stringify(aaaa)),
                                        }) 
                                        }  
                                        }       
                                })
                        }else{
                                wx.showToast({
                                        title: '请您输入正确的姓名或账号',
                                        icon: 'none',
                                        duration: 2000,
                                })
                        }
                  }
                })
        }
})

wx.navigateTo({
        url: './next_one/next_one',
        })